<template>
	<view class="container">
		<view class="" style="display: flex;align-items: center;margin-top: 10px;">
			<view class="tag">联系电话：</view>
			<uni-easyinput v-model="user.phonenumber" type="number" maxlength="11" placeholder="请输入联系电话" />
		</view>
		<button type="primary" @click="submit" style="margin-top: 20px;">修改</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {
					"phonenumber": "",
				}
			};
		},
		onLoad(item) {

		},
		onReady() {

		},
		onShow() {
			this.user = uni.getStorageSync("user")
			this.avatar = this.baseUrl + "/prod-api" + this.user.avatar
		},
		methods: {
			err() {
				this.avatar = "/static/tx.png"
			},
			submit() {
				this.put('/prod-api/api/common/user', this.user).then(res => {
					if (res.code === 200) {
						this.get('/prod-api/api/common/user/getInfo', {

						}, ).then(res => {
							let data = res.user
							uni.setStorageSync("user", data)
						})
						setTimeout(function() {
							uni.navigateBack({
								delta: 1
							});
						}, 300);
					}
					uni.showToast({
						title: res.msg,
						icon: 'none'
					});

				})
			}
		}
	};
</script>

<style lang="scss">
	page {
		background-color: white;
	}

	.tag {
		width: 6em;
	}
</style>
